import org.junit.Test;

import java.time.*;
import java.time.format.DateTimeFormatter;

public class Time {
    @Test
    public void test() {
        Instant now = Instant.now();
        System.out.println("now>>>" + now);
        LocalTime time = LocalTime.now();
        System.out.println("time>>>" + time);
        LocalDate date = LocalDate.now();
        System.out.println("date>>>" + date);
    }

    @Test
    public void test2() {
        ZonedDateTime now = ZonedDateTime.now();
        System.out.println(now);
        Instant instant = now.toInstant();
        System.out.println(instant);
    }

    @Test
    public void test3() {
        //LocalDate localDate = LocalDate.now();
        LocalDateTime localDate = LocalDateTime.now();
        String data = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        //  String data = localDate.format(DateTimeFormatter.ISO_LOCAL_TIME);
        LocalDateTime parse = LocalDateTime.parse(data, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        String format = parse.format(DateTimeFormatter.ISO_DATE);
        System.out.println(format);
        System.out.println(data);
    }
}
